<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>买得网 - 商户登陆</title>
    <link href="<?=base_url('public/css/admin_login.css')?>" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="http://libs.baidu.com/jquery/1.8.3/jquery.min.js"></script>
    <script type="text/javascript" src="<?=base_url('public/lib/jqusey.form.js')?>"></script>
    <script type="text/javascript" src="<?=base_url('public/lib/layer/layer.js')?>"></script>
</head>
<body>
<div class="admin_login_wrap">
    <h1>买得网 - 商户登陆</h1>
    <div class="adming_login_border">
        <div class="admin_input">
            <form action="<?=site_url('shops/login/index') ?>" method="post" id="myform">
                <ul class="admin_items">
                    <li>
                        <label for="user">用户名：</label>
                        <input type="text" name="username" value="" id="user" placeholder="请输入用户名" size="40" class="admin_input_style" />
                    </li>
                    <li>
                        <label for="pwd">密码：</label>
                        <input type="password" name="password" value="" id="pwd" placeholder="请输入密码" size="40" class="admin_input_style" />
                    </li>
                    <li>
                        <label for="pwd">验证码：</label>
                        <input type="text" name="cap" value="" id="pwd" placeholder="请输入验证码" size="40" class="admin_input_style" />
                    </li>
                    <li>
                        <label onclick="reset_cap()" title="点击刷新验证码" id="cap"><?=$cap?></label>
                    </li>
                    <li>
                        <input type="submit" tabindex="3" value="提交" class="btn btn-primary" />
                    </li>
                    <li><span style="color: red"><?= empty($mess) ? '' : $mess?></span></li>
                </ul>
            </form>
        </div>
    </div>
    <p class="admin_copyright"><a tabindex="5" href="<?=site_url()?>" target="_blank">返回首页</a> &copy; 2014 Powered by <a href="<?=base_url()?>" target="_blank">官网</a></p>
</div>

<script type="text/javascript">
    function reset_cap(){
        $.get("<?=site_url('shops/login/reset_cap')?>",function(res){
            $("#cap").html(res);
        });
    }

    $('#myform').submit(function() {
            $(this).ajaxSubmit(function(data){
                if(data == 1){
                    location.href="<?=site_url('shops/login')?>";
                    
                }else{
                    reset_cap();
                    layer.alert(data,{
                        icon:2,
                    });
                }
            })
            return false;
        })

</script>
</body>
</html>